/**
 * @param {number[]} nums
 * @return {number}
*/
var missingNumber = function(nums) {
  nums.sort((a, b) => a - b);
  let count = 0;
  for(let i = 0; i < nums.length; i++) {
    if(nums[i] != count) return count;
    count++;
  }
  return count;
};
let nums = [3,0,1];
console.log(missingNumber(nums));
nums = [9,6,4,2,3,5,7,0,1];
console.log(missingNumber(nums));
